import book.BookRack;
import user.CommonUser;
import user.SuperUser;
import user.User;

import java.util.Scanner;

public class Main {
    public static User login() {
        System.out.println("请输入你的名字:");
        Scanner scanner = new Scanner(System.in);
        String name = scanner.nextLine();
        System.out.println("请输入你的身份-> 0.普通管理员 1.超级管理员:");
        int key = scanner.nextInt();
        if (key == 0 ) {
            return new CommonUser(name);
        }else {
            return new SuperUser(name);
        }
    }

    public static void main(String[] args) {
        BookRack bookRack = new BookRack();
        User user = login();
        while(true) {
            int choise = user.menu();
            user.work(choise,bookRack);
        }
    }
}
